//代理模式   
#include <string>
#include <iostream>
#include <memory>
class Girl
{
public:
    Girl(std::string name) : m_name(name) {}
    std::string getName() { return m_name; }
    void setName(std::string name) { m_name = name; }
    ~Girl(){};
private:
    std::string m_name;
};

class AbsGiveGift
{
public:
    virtual void giveDolls() = 0;
    virtual void giveFlowers() = 0;
    virtual void giveChocolate() = 0;
};

class Persuit : public AbsGiveGift
{
public:
    using ptr = std::shared_ptr<Persuit>;
    Persuit(Girl girl) : m_girl(girl) {}
    ~Persuit() {}
    void giveDolls() override
    {
        std::cout << m_girl.getName() << "，送你洋娃娃" << std::endl;
    }
    void giveFlowers() override
    {
        std::cout << m_girl.getName() << "，送你玫瑰花" << std::endl;
    }
    void giveChocolate() override
    {
        std::cout << m_girl.getName() << "，送你巧克力" << std::endl;
    }

private:
    Girl m_girl;
};

class Proxy : public AbsGiveGift
{
public:
    using ptr = std::shared_ptr<Proxy>;
    Proxy(Girl girl) : m_persuit(new Persuit(girl))
    {
    }
    ~Proxy() {}
    void giveFlowers()
    {
        m_persuit->giveDolls();
    }
    void giveDolls()
    {
        m_persuit->giveFlowers();
    }
    void giveChocolate() 
    {
        m_persuit->giveChocolate();
    }

private:
    Persuit::ptr m_persuit;
};

int main(int argc, char** argv)
{
    Girl girl("李娇娇");
    Proxy::ptr proxy(new Proxy(girl));
    proxy->giveDolls();
    proxy->giveFlowers();
    proxy->giveChocolate();
    return 0;
}